package com.face;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;

public class ConsumerTest1 {

    static void functionDemo1() {
        Function<Integer, String> function = new Function<Integer, String>() {
            @Override
            public String apply(Integer integer) {
                return integer.toString() + "程序员节";
            }
        };
        System.out.println("functionDemo1 --> " + function.apply(1024));
    }
    static void functionDemo2() {
        Function<Integer, String> function = (integer) -> integer.toString() + "程序员节";

        System.out.println("functionDemo2 --> " + function.apply(1024));
    }    public static void testConsumer(){
        Consumer<List<String>> consumer=v ->v.forEach(System.out::println);
        testConsumer(Arrays.asList("张三","李四","王五"),consumer);

        testConsumer(Arrays.asList("张三1","李四1","王五1"),consumer);

    }
    public static void testConsumer(List<String> list,Consumer<List<String>> consumer){
        consumer.accept(list);

    }
    static void predicateDemo1() {
        Predicate<Integer> predicate = integer -> integer == 1025;
        System.out.println("predicateDemo1 --> " + predicate.test(1024));
    }
    static void predicateDemo2(Integer integer, Predicate<Integer> predicate) {
        System.out.println("predicateDemo1 --> " + predicate.test(integer));
    }

    public static void main(String[] args) {
      //  functionDemo1();
      //  functionDemo2();
       // TestConsumer();
        predicateDemo1();
       // predicateDemo2(1024, integer -> integer == 1024);
    }


}
